package com.suda.catalina.myapplication;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class AlterNameActivity extends AppCompatActivity {

    private EditText editText;
    private Button button;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_alter_name);

        editText = (EditText) findViewById(R.id.alterNameEditText);
        button = (Button) findViewById(R.id.saveAlterName);

        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String data = editText.getText().toString();
                if (!TextUtils.isEmpty(data)) {
                    EditFile.saveData(AlterNameActivity.this, data);
                    finish();
                }
                else
                    Toast.makeText(AlterNameActivity.this, "请输入新昵称", Toast.LENGTH_SHORT).show();

            }
        });
    }
}
